import { FieldType } from '.';
export default class ReportFieldCellType extends window.GC.Spread.Sheets.CellTypes.Text {
    row;
    col;
    rowCount;
    colCount;
    typeName = 'ReportFieldCellType';
    label;
    fieldType;
    dataTable;
    dataTableName;
    detailDataTable;

    dataField;
    dataFieldName;
    leftParentType;
    upParentType;
    customLeftParentCell;
    customUpParentCell;
    showType;
    expandType;
    id;
    sheetName;

    format(value, format, formattedData, context) {
        if (this.fieldType === FieldType.DataSourceField) {
            return this.dataTableName && this.dataFieldName ? `${this.dataTableName}.${this.dataFieldName}` : '';
        } else {
            return this.label;
        }
    }
    initFromField = (row, col, rowCount, colCount, field) => {
        this.row = row;
        this.col = col;
        this.rowCount = rowCount;
        this.colCount = colCount;
        this.label = field.name;
        this.dataField = field.fieldName;
        this.dataFieldName = field.name;
        this.dataTable = field.mainTable;
        this.dataTableName = field.mainTableName;
        this.detailDataTable = field.detailTable;
        this.showType = field.showType;
        this.expandType = field.expandType;
        this.fieldType = field.fieldType;
        this.leftParentType = field.leftParentType;
        this.upParentType = field.upParentType;
        this.customLeftParentCell = field.customLeftParentCell;
        this.customUpParentCell = field.customUpParentCell;
        return this;
    }
}
